﻿using Volo.Abp.Modularity;
using Volo.Abp.Localization;
using Joy.Erp.BasicArchives.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Validation;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;
using Volo.Abp.UI.Navigation.Localization.Resource;
using Volo.Abp.UI.Navigation;
using Volo.Abp.SettingManagement;
using EasyAbp.Abp.Trees;

namespace Joy.Erp.BasicArchives;

[DependsOn(
    typeof(AbpValidationModule),
    typeof(AbpUiNavigationModule),
    typeof(AbpSettingManagementDomainSharedModule),
    typeof(AbpTreesDomainSharedModule)
)]
public class BasicArchivesDomainSharedModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpVirtualFileSystemOptions>(options =>
        {
            options.FileSets.AddEmbedded<BasicArchivesDomainSharedModule>();
        });

        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Add<BasicArchivesResource>("zh-Hans")
                .AddBaseTypes(typeof(AbpValidationResource))
                .AddVirtualJson("/Localization/BasicArchives");

            options.Resources
                .Get<AbpUiNavigationResource>()
                .AddVirtualJson("/Localization/AbpUiNavigation");

            options.AssemblyResources(typeof(BasicArchivesDomainSharedModule).Assembly);

            options.Resources
                .Get<BasicArchivesResource>()
                .AddVirtualJson("/Localization/Extensions");
        });

        Configure<AbpExceptionLocalizationOptions>(options =>
        {
            options.MapCodeNamespace("BasicArchives", typeof(BasicArchivesResource));
        });
    }
}
